")
.html(content)
.find(slide.opts.filter);
}}
slide.$slide.one("onReset", function (){
$(this)
.find("video,audio")
.trigger("pause");
if(slide.$placeholder){
slide.$placeholder.after(content.removeClass("modula-fancybox-content").hide()).remove();
slide.$placeholder=null;
}
if(slide.$smallBtn){
slide.$smallBtn.remove();
slide.$smallBtn=null;
}
if(!slide.hasError){
$(this).empty();
slide.isLoaded=false;
slide.isRevealed=false;
}});
$(content).appendTo(slide.$slide);
if($(content).is("video,audio")){
$(content).addClass("modula-fancybox-video");
$(content).wrap("
");
slide.contentType="video";
slide.opts.width=slide.opts.width||$(content).attr("width");
slide.opts.height=slide.opts.height||$(content).attr("height");
}
slide.$content=slide.$slide
.children()
.filter("div,form,main,video,audio,article,.modula-fancybox-content")
.first();
slide.$content.siblings().hide();
if(!slide.$content.length){
slide.$content=slide.$slide
.wrapInner("
")
.children()
.first();
}
slide.$content.addClass("modula-fancybox-content");
slide.$slide.addClass("modula-fancybox-slide--" + slide.contentType);
self.afterLoad(slide);
},
setError: function (slide){
slide.hasError=true;
slide.$slide
.trigger("onReset")
.removeClass("modula-fancybox-slide--" + slide.contentType)
.addClass("modula-fancybox-slide--error");
slide.contentType="html";
this.setContent(slide, this.translate(slide, slide.opts.errorTpl));
if(slide.pos===this.currPos){
this.isAnimating=false;
}},
showLoading: function (slide){
var self=this;
slide=slide||self.current;
if(slide&&!slide.$spinner){
slide.$spinner=$(self.translate(self, self.opts.spinnerTpl))
.appendTo(slide.$slide)
.hide()
.fadeIn("fast");
}},
hideLoading: function (slide){
var self=this;
slide=slide||self.current;
if(slide&&slide.$spinner){
slide.$spinner.stop().remove();
delete slide.$spinner;
}},
afterLoad: function (slide){
var self=this;
if(self.isClosing){
return;
}
slide.isLoading=false;
slide.isLoaded=true;
self.trigger("afterLoad", slide);
self.hideLoading(slide);
if(slide.opts.smallBtn&&(!slide.$smallBtn||!slide.$smallBtn.length)){
slide.$smallBtn=$(self.translate(slide, slide.opts.btnTpl.smallBtn)).appendTo(slide.$content);
}
if(slide.opts.protect&&slide.$content&&!slide.hasError){
slide.$content.on("contextmenu.fb", function (e){
if(e.button==2){
e.preventDefault();
}
return true;
});
if(slide.type==="image"){
$('
').appendTo(slide.$content);
}}
self.adjustCaption(slide);
self.adjustLayout(slide);
if(slide.pos===self.currPos){
self.updateCursor();
}
self.revealContent(slide);
},
adjustCaption: function (slide){
var self=this,
current=slide||self.current,
caption=current.opts.caption,
preventOverlap=current.opts.preventCaptionOverlap,
$caption=self.$refs.caption,
$clone,
captionH=false;
$caption.toggleClass("modula-fancybox-caption--separate", preventOverlap);
if(preventOverlap&&caption&&caption.length){
if(current.pos!==self.currPos){
$clone=$caption.clone().appendTo($caption.parent());
$clone
.children()
.eq(0)
.empty()
.html(caption);
captionH=$clone.outerHeight(true);
$clone.empty().remove();
}else if(self.$caption){
captionH=self.$caption.outerHeight(true);
}
current.$slide.css("padding-bottom", captionH||"");
}},
adjustLayout: function (slide){
var self=this,
current=slide||self.current,
scrollHeight,
marginBottom,
inlinePadding,
actualPadding;
if(current.isLoaded&¤t.opts.disableLayoutFix!==true){
current.$content.css("margin-bottom", "");
if(current.$content.outerHeight() > current.$slide.height() + 0.5){
inlinePadding=current.$slide[0].style["padding-bottom"];
actualPadding=current.$slide.css("padding-bottom");
if(parseFloat(actualPadding) > 0){
scrollHeight=current.$slide[0].scrollHeight;
current.$slide.css("padding-bottom", 0);
if(Math.abs(scrollHeight - current.$slide[0].scrollHeight) < 1){
marginBottom=actualPadding;
}
current.$slide.css("padding-bottom", inlinePadding);
}}
current.$content.css("margin-bottom", marginBottom);
}},
revealContent: function (slide){
var self=this,
$slide=slide.$slide,
end=false,
start=false,
isMoved=self.isMoved(slide),
isRevealed=slide.isRevealed,
effect,
effectClassName,
duration,
opacity;
slide.isRevealed=true;
effect=slide.opts[self.firstRun ? "animationEffect":"transitionEffect"];
duration=slide.opts[self.firstRun ? "animationDuration":"transitionDuration"];
duration=parseInt(slide.forcedDuration===undefined ? duration:slide.forcedDuration, 10);
if(isMoved||slide.pos!==self.currPos||!duration){
effect=false;
}
if(effect==="zoom"){
if(slide.pos===self.currPos&&duration&&slide.type==="image"&&!slide.hasError&&(start=self.getThumbPos(slide))){
end=self.getFitPos(slide);
}else{
effect="fade";
}}
if(effect==="zoom"){
self.isAnimating=true;
end.scaleX=end.width / start.width;
end.scaleY=end.height / start.height;
opacity=slide.opts.zoomOpacity;
if(opacity=="auto"){
opacity=Math.abs(slide.width / slide.height - start.width / start.height) > 0.1;
}
if(opacity){
start.opacity=0.1;
end.opacity=1;
}
$.modulaFancybox.setTranslate(slide.$content.removeClass("modula-fancybox-is-hidden"), start);
forceRedraw(slide.$content);
$.modulaFancybox.animate(slide.$content, end, duration, function (){
self.isAnimating=false;
self.complete();
});
return;
}
self.updateSlide(slide);
if(!effect){
slide.$content.removeClass("modula-fancybox-is-hidden");
if(!isRevealed&&isMoved&&slide.type==="image"&&!slide.hasError){
slide.$content.hide().fadeIn("fast");
}
if(slide.pos===self.currPos){
self.complete();
}
return;
}
$.modulaFancybox.stop($slide);
effectClassName="modula-fancybox-slide--" + (slide.pos >=self.prevPos ? "next":"previous") + " modula-fancybox-animated fancybox-fx-" + effect;
$slide.addClass(effectClassName).removeClass("modula-fancybox-slide--current");
slide.$content.removeClass("modula-fancybox-is-hidden");
forceRedraw($slide);
if(slide.type!=="image"){
slide.$content.hide().show(0);
}
$.modulaFancybox.animate($slide,
"modula-fancybox-slide--current",
duration,
function (){
$slide.removeClass(effectClassName).css({
transform: "",
opacity: ""
});
if(slide.pos===self.currPos){
self.complete();
}},
true
);
},
getThumbPos: function (slide){
var rez=false,
$thumb=slide.$thumb,
thumbPos,
btw,
brw,
bbw,
blw;
if(!$thumb||!inViewport($thumb[0])){
return false;
}
thumbPos=$.modulaFancybox.getTranslate($thumb);
btw=parseFloat($thumb.css("border-top-width")||0);
brw=parseFloat($thumb.css("border-right-width")||0);
bbw=parseFloat($thumb.css("border-bottom-width")||0);
blw=parseFloat($thumb.css("border-left-width")||0);
rez={
top: thumbPos.top + btw,
left: thumbPos.left + blw,
width: thumbPos.width - brw - blw,
height: thumbPos.height - btw - bbw,
scaleX: 1,
scaleY: 1
};
return thumbPos.width > 0&&thumbPos.height > 0 ? rez:false;
},
complete: function (){
var self=this,
current=self.current,
slides={},
$el;
if(self.isMoved()||!current.isLoaded){
return;
}
if(!current.isComplete){
current.isComplete=true;
current.$slide.siblings().trigger("onReset");
self.preload("inline");
forceRedraw(current.$slide);
current.$slide.addClass("modula-fancybox-slide--complete");
$.each(self.slides, function (key, slide){
if(slide.pos >=self.currPos - 1&&slide.pos <=self.currPos + 1){
slides[slide.pos]=slide;
}else if(slide){
$.modulaFancybox.stop(slide.$slide);
slide.$slide.off().remove();
}});
self.slides=slides;
}
self.isAnimating=false;
self.updateCursor();
self.trigger("afterShow");
if(!!current.opts.video.autoStart){
current.$slide
.find("video,audio")
.filter(":visible:first")
.trigger("play")
.one("ended", function (){
if(Document.exitFullscreen){
Document.exitFullscreen();
}else if(this.webkitExitFullscreen){
this.webkitExitFullscreen();
}
self.next();
});
}
if(current.opts.autoFocus&¤t.contentType==="html"){
$el=current.$content.find("input[autofocus]:enabled:visible:first");
if($el.length){
$el.trigger("focus");
}else{
self.focus(null, true);
}}
current.$slide.scrollTop(0).scrollLeft(0);
},
preload: function (type){
var self=this,
prev,
next;
if(self.group.length < 2){
return;
}
next=self.slides[self.currPos + 1];
prev=self.slides[self.currPos - 1];
if(prev&&prev.type===type){
self.loadSlide(prev);
}
if(next&&next.type===type){
self.loadSlide(next);
}},
focus: function (e, firstRun){
var self=this,
focusableStr=[
"a[href]",
"area[href]",
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
"select:not([disabled]):not([aria-hidden])",
"textarea:not([disabled]):not([aria-hidden])",
"button:not([disabled]):not([aria-hidden])",
"iframe",
"object",
"embed",
"video",
"audio",
"[contenteditable]",
'[tabindex]:not([tabindex^="-"])'
].join(","),
focusableItems,
focusedItemIndex;
if(self.isClosing){
return;
}
if(e||!self.current||!self.current.isComplete){
focusableItems=self.$refs.container.find("*:visible");
}else{
focusableItems=self.current.$slide.find("*:visible" + (firstRun ? ":not(.modula-fancybox-close-small)":""));
}
focusableItems=focusableItems.filter(focusableStr).filter(function (){
return $(this).css("visibility")!=="hidden"&&!$(this).hasClass("disabled");
});
if(focusableItems.length){
focusedItemIndex=focusableItems.index(document.activeElement);
if(e&&e.shiftKey){
if(focusedItemIndex < 0||focusedItemIndex==0){
e.preventDefault();
focusableItems.eq(focusableItems.length - 1).trigger("focus");
}}else{
if(focusedItemIndex < 0||focusedItemIndex==focusableItems.length - 1){
if(e){
e.preventDefault();
}
focusableItems.eq(0).trigger("focus");
}}
}else{
self.$refs.container.trigger("focus");
}},
activate: function (){
var self=this;
$(".modula-fancybox-container").each(function (){
var instance=$(this).data("modulaFancyBox");
if(instance&&instance.id!==self.id&&!instance.isClosing){
instance.trigger("onDeactivate");
instance.removeEvents();
instance.isVisible=false;
}});
self.isVisible=true;
if(self.current||self.isIdle){
self.update();
self.updateControls();
}
self.trigger("onActivate");
self.addEvents();
},
close: function (e, d){
var self=this,
current=self.current,
effect,
duration,
$content,
domRect,
opacity,
start,
end;
var done=function (){
self.cleanUp(e);
};
if(self.isClosing){
return false;
}
self.isClosing=true;
if(self.trigger("beforeClose", e)===false){
self.isClosing=false;
requestAFrame(function (){
self.update();
});
return false;
}
self.removeEvents();
$content=current.$content;
effect=current.opts.animationEffect;
duration=$.isNumeric(d) ? d:effect ? current.opts.animationDuration:0;
current.$slide.removeClass("modula-fancybox-slide--complete modula-fancybox-slide--next modula-fancybox-slide--previous modula-fancybox-animated");
if(e!==true){
$.modulaFancybox.stop(current.$slide);
}else{
effect=false;
}
current.$slide
.siblings()
.trigger("onReset")
.remove();
if(duration){
self.$refs.container
.removeClass("modula-fancybox-is-open")
.addClass("modula-fancybox-is-closing")
.css("transition-duration", duration + "ms");
}
self.hideLoading(current);
self.hideControls(true);
self.updateCursor();
if(effect==="zoom" &&
!($content&&duration&¤t.type==="image"&&!self.isMoved()&&!current.hasError&&(end=self.getThumbPos(current)))
){
effect="fade";
}
if(effect==="zoom"){
$.modulaFancybox.stop($content);
domRect=$.modulaFancybox.getTranslate($content);
start={
top: domRect.top,
left: domRect.left,
scaleX: domRect.width / end.width,
scaleY: domRect.height / end.height,
width: end.width,
height: end.height
};
opacity=current.opts.zoomOpacity;
if(opacity=="auto"){
opacity=Math.abs(current.width / current.height - end.width / end.height) > 0.1;
}
if(opacity){
end.opacity=0;
}
$.modulaFancybox.setTranslate($content, start);
forceRedraw($content);
$.modulaFancybox.animate($content, end, duration, done);
return true;
}
if(effect&&duration){
$.modulaFancybox.animate(current.$slide.addClass("modula-fancybox-slide--previous").removeClass("modula-fancybox-slide--current"),
"modula-fancybox-animated modula-fancybox-fx-" + effect,
duration,
done
);
}else{
if(e===true){
setTimeout(done, duration);
}else{
done();
}}
return true;
},
cleanUp: function (e){
var self=this,
instance,
$focus=self.current.opts.$orig,
x,
y;
self.current.$slide.trigger("onReset");
self.$refs.container.empty().remove();
self.trigger("afterClose", e);
if(!!self.current.opts.backFocus){
if(!$focus||!$focus.length||!$focus.is(":visible")){
$focus=self.$trigger;
}
if($focus&&$focus.length){
x=window.scrollX;
y=window.scrollY;
$focus.trigger("focus");
$("html, body")
.scrollTop(y)
.scrollLeft(x);
}}
self.current=null;
instance=$.modulaFancybox.getInstance();
if(instance){
instance.activate();
}else{
$("body").removeClass("modula-fancybox-active compensate-for-scrollbar");
$("#modula-fancybox-style-noscroll").remove();
}},
trigger: function (name, slide){
var args=Array.prototype.slice.call(arguments, 1),
self=this,
obj=slide&&slide.opts ? slide:self.current,
rez;
if(obj){
args.unshift(obj);
}else{
obj=self;
}
args.unshift(self);
if($.isFunction(obj.opts[name])){
rez=obj.opts[name].apply(obj, args);
}
if(rez===false){
return rez;
}
if(name==="afterClose"||!self.$refs){
$D.trigger(name + ".fb", args);
}else{
self.$refs.container.trigger(name + ".fb", args);
}},
updateControls: function (){
var self=this,
current=self.current,
index=current.index,
$container=self.$refs.container,
$caption=self.$refs.caption,
caption=current.opts.caption;
current.$slide.trigger("refresh");
if(caption&&caption.length){
self.$caption=$caption;
$caption
.children()
.eq(0)
.html(caption);
}else{
self.$caption=null;
}
if(!self.hasHiddenControls&&!self.isIdle){
self.showControls();
}
$container.find("[data-fancybox-count]").html(self.group.length);
$container.find("[data-fancybox-index]").html(index + 1);
$container.find("[data-fancybox-prev]").prop("disabled", !current.opts.loop&&index <=0);
$container.find("[data-fancybox-next]").prop("disabled", !current.opts.loop&&index >=self.group.length - 1);
if(current.type==="image"){
$container
.find("[data-fancybox-zoom]")
.show()
.end()
.find("[data-fancybox-download]")
.attr("href", current.opts.image.src||current.src)
.show();
}else if(current.opts.toolbar){
$container.find("[data-fancybox-download],[data-fancybox-zoom]").hide();
}
if($(document.activeElement).is(":hidden,[disabled]")){
self.$refs.container.trigger("focus");
}},
hideControls: function (andCaption){
var self=this,
arr=["infobar", "toolbar", "nav"];
if(andCaption||!self.current.opts.preventCaptionOverlap){
arr.push("caption");
}
this.$refs.container.removeClass(arr
.map(function (i){
return "modula-fancybox-show-" + i;
})
.join(" ")
);
this.hasHiddenControls=true;
},
showControls: function (){
var self=this,
opts=self.current ? self.current.opts:self.opts,
$container=self.$refs.container;
self.hasHiddenControls=false;
self.idleSecondsCounter=0;
$container
.toggleClass("modula-fancybox-show-toolbar", !!(opts.toolbar&&opts.buttons))
.toggleClass("modula-fancybox-show-infobar", !!(opts.infobar&&self.group.length > 1))
.toggleClass("modula-fancybox-show-caption", !!self.$caption)
.toggleClass("modula-fancybox-show-nav", !!(opts.arrows&&self.group.length > 1))
.toggleClass("modula-fancybox-is-modal", !!opts.modal);
},
toggleControls: function (){
if(this.hasHiddenControls){
this.showControls();
}else{
this.hideControls();
}}
});
$.modulaFancybox={
version: "3.5.7",
defaults: defaults,
getInstance: function (command){
var instance=$('.modula-fancybox-container:not(".modula-fancybox-is-closing"):last').data("modulaFancyBox"),
args=Array.prototype.slice.call(arguments, 1);
if(instance instanceof modulaFancyBox){
if($.type(command)==="string"){
instance[command].apply(instance, args);
}else if($.type(command)==="function"){
command.apply(instance, args);
}
return instance;
}
return false;
},
open: function (items, opts, index){
return new modulaFancyBox(items, opts, index);
},
close: function (all){
var instance=this.getInstance();
if(instance){
instance.close();
if(all===true){
this.close(all);
}}
},
destroy: function (){
this.close(true);
$D.add("body").off("click.fb-start", "**");
},
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),
use3d: (function (){
var div=document.createElement("div");
return (
window.getComputedStyle &&
window.getComputedStyle(div) &&
window.getComputedStyle(div).getPropertyValue("transform") &&
!(document.documentMode&&document.documentMode < 11)
);
})(),
getTranslate: function ($el){
var domRect;
if(!$el||!$el.length){
return false;
}
domRect=$el[0].getBoundingClientRect();
return {
top: domRect.top||0,
left: domRect.left||0,
width: domRect.width,
height: domRect.height,
opacity: parseFloat($el.css("opacity"))
};},
setTranslate: function ($el, props){
var str="",
css={};
if(!$el||!props){
return;
}
if(props.left!==undefined||props.top!==undefined){
str =
(props.left===undefined ? $el.position().left:props.left) +
"px, " +
(props.top===undefined ? $el.position().top:props.top) +
"px";
if(this.use3d){
str="translate3d(" + str + ", 0px)";
}else{
str="translate(" + str + ")";
}}
if(props.scaleX!==undefined&&props.scaleY!==undefined){
str +=" scale(" + props.scaleX + ", " + props.scaleY + ")";
}else if(props.scaleX!==undefined){
str +=" scaleX(" + props.scaleX + ")";
}
if(str.length){
css.transform=str;
}
if(props.opacity!==undefined){
css.opacity=props.opacity;
}
if(props.width!==undefined){
css.width=props.width;
}
if(props.height!==undefined){
css.height=props.height;
}
return $el.css(css);
},
animate: function ($el, to, duration, callback, leaveAnimationName){
var self=this,
from;
if($.isFunction(duration)){
callback=duration;
duration=null;
}
self.stop($el);
from=self.getTranslate($el);
$el.on(transitionEnd, function (e){
if(e&&e.originalEvent&&(!$el.is(e.originalEvent.target)||e.originalEvent.propertyName=="z-index")){
return;
}
self.stop($el);
if($.isNumeric(duration)){
$el.css("transition-duration", "");
}
if($.isPlainObject(to)){
if(to.scaleX!==undefined&&to.scaleY!==undefined){
self.setTranslate($el, {
top: to.top,
left: to.left,
width: from.width * to.scaleX,
height: from.height * to.scaleY,
scaleX: 1,
scaleY: 1
});
}}else if(leaveAnimationName!==true){
$el.removeClass(to);
}
if($.isFunction(callback)){
callback(e);
}});
if($.isNumeric(duration)){
$el.css("transition-duration", duration + "ms");
}
if($.isPlainObject(to)){
if(to.scaleX!==undefined&&to.scaleY!==undefined){
delete to.width;
delete to.height;
if($el.parent().hasClass("modula-fancybox-slide--image")){
$el.parent().addClass("modula-fancybox-is-scaling");
}}
$.modulaFancybox.setTranslate($el, to);
}else{
$el.addClass(to);
}
$el.data("timer",
setTimeout(function (){
$el.trigger(transitionEnd);
}, duration + 33)
);
},
stop: function ($el, callCallback){
if($el&&$el.length){
clearTimeout($el.data("timer"));
if(callCallback){
$el.trigger(transitionEnd);
}
$el.off(transitionEnd).css("transition-duration", "");
$el.parent().removeClass("modula-fancybox-is-scaling");
}}
};
function _run(e, opts){
var items=[],
index=0,
$target,
value,
instance;
if(e&&e.isDefaultPrevented()){
return;
}
e.preventDefault();
opts=opts||{};
if(e&&e.data){
opts=mergeOpts(e.data.options, opts);
}
$target=opts.$target||$(e.currentTarget).trigger("blur");
instance=$.modulaFancybox.getInstance();
if(instance&&instance.$trigger&&instance.$trigger.is($target)){
return;
}
if(opts.selector){
items=$(opts.selector);
}else{
value=$target.attr("data-fancybox")||"";
if(value){
items=e.data ? e.data.items:[];
items=items.length ? items.filter('[data-fancybox="' + value + '"]'):$('[data-fancybox="' + value + '"]');
}else{
items=[$target];
}}
index=$(items).index($target);
if(index < 0){
index=0;
}
instance=$.modulaFancybox.open(items, opts, index);
instance.$trigger=$target;
}
$.fn.modulaFancybox=function (options){
var selector;
options=options||{};
selector=options.selector||false;
if(selector){
$("body")
.off("click.fb-start", selector)
.on("click.fb-start", selector, {
options: options
}, _run);
}else{
this.off("click.fb-start").on("click.fb-start", {
items: this,
options: options
},
_run
);
}
return this;
};
$D.on("click.fb-start", "[data-fancybox]", _run);
$D.on("click.fb-start", "[data-fancybox-trigger]", function (e){
$('[data-fancybox="' + $(this).attr("data-fancybox-trigger") + '"]')
.eq($(this).attr("data-fancybox-index")||0)
.trigger("click.fb-start", {
$trigger: $(this)
});
});
(function (){
var buttonStr=".modula-fancybox-button",
focusStr="modula-fancybox-focus",
$pressed=null;
$D.on("mousedown mouseup focus blur", buttonStr, function (e){
switch (e.type){
case "mousedown":
$pressed=$(this);
break;
case "mouseup":
$pressed=null;
break;
case "focusin":
$(buttonStr).removeClass(focusStr);
if(!$(this).is($pressed)&&!$(this).is("[disabled]")){
$(this).addClass(focusStr);
}
break;
case "focusout":
$(buttonStr).removeClass(focusStr);
break;
}});
})();
})(window, document, jQuery);
(function ($){
"use strict";
var defaults={
youtube: {
matcher: /(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(watch\?(.*&)?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*))(.*)/i,
params: {
autoplay: 1,
autohide: 1,
fs: 1,
rel: 0,
hd: 1,
wmode: "transparent",
enablejsapi: 1,
html5: 1
},
paramPlace: 8,
type: "iframe",
url: "https://www.youtube-nocookie.com/embed/$4",
thumb: "https://img.youtube.com/vi/$4/hqdefault.jpg"
},
vimeo: {
matcher: /^.+vimeo.com\/(.*\/)?([\d]+)(.*)?/,
params: {
autoplay: 1,
hd: 1,
show_title: 1,
show_byline: 1,
show_portrait: 0,
fullscreen: 1
},
paramPlace: 3,
type: "iframe",
url: "//player.vimeo.com/video/$2"
},
instagram: {
matcher: /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
type: "image",
url: "//$1/p/$2/media/?size=l"
},
gmap_place: {
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(((maps\/(place\/(.*)\/)?\@(.*),(\d+.?\d+?)z))|(\?ll=))(.*)?/i,
type: "iframe",
url: function (rez){
return (
"//maps.google." +
rez[2] +
"/?ll=" +
(rez[9] ? rez[9] + "&z=" + Math.floor(rez[10]) + (rez[12] ? rez[12].replace(/^\//, "&"):""):rez[12] + "").replace(/\?/, "&") +
"&output=" +
(rez[12]&&rez[12].indexOf("layer=c") > 0 ? "svembed":"embed")
);
}},
gmap_search: {
matcher: /(maps\.)?google\.([a-z]{2,3}(\.[a-z]{2})?)\/(maps\/search\/)(.*)/i,
type: "iframe",
url: function (rez){
return "//maps.google." + rez[2] + "/maps?q=" + rez[5].replace("query=", "q=").replace("api=1", "") + "&output=embed";
}}
};
var format=function (url, rez, params){
if(!url){
return;
}
params=params||"";
if($.type(params)==="object"){
params=$.param(params, true);
}
$.each(rez, function (key, value){
url=url.replace("$" + key, value||"");
});
if(params.length){
url +=(url.indexOf("?") > 0 ? "&":"?") + params;
}
return url;
};
$(document).on("objectNeedsType.fb", function (e, instance, item){
var url=item.src||"",
type=false,
media,
thumb,
rez,
params,
urlParams,
paramObj,
provider;
media=$.extend(true, {}, defaults, item.opts.media);
$.each(media, function (providerName, providerOpts){
rez=url.match(providerOpts.matcher);
if(!rez){
return;
}
type=providerOpts.type;
provider=providerName;
paramObj={};
if(providerOpts.paramPlace&&rez[providerOpts.paramPlace]){
urlParams=rez[providerOpts.paramPlace];
if(urlParams[0]=="?"){
urlParams=urlParams.substring(1);
}
urlParams=urlParams.split("&");
for (var m=0; m < urlParams.length; ++m){
var p=urlParams[m].split("=", 2);
if(p.length==2){
paramObj[p[0]]=decodeURIComponent(p[1].replace(/\+/g, " "));
}}
}
params=$.extend(true, {}, providerOpts.params, item.opts[providerName], paramObj);
url =
$.type(providerOpts.url)==="function" ? providerOpts.url.call(this, rez, params, item):format(providerOpts.url, rez, params);
thumb =
$.type(providerOpts.thumb)==="function" ? providerOpts.thumb.call(this, rez, params, item):format(providerOpts.thumb, rez);
if(providerName==="youtube"){
url=url.replace(/&t=(\d+)/, function (match, p1){
return "&start=" + p1;
});
}else if(providerName==="vimeo"){
url=url.replace("&%23", "#");
}
return false;
});
if(type){
if(!item.opts.thumb&&!(item.opts.$thumb&&item.opts.$thumb.length)){
item.opts.thumb=thumb;
}
if(type==="iframe"){
item.opts=$.extend(true, item.opts, {
iframe: {
preload: false,
attr: {
scrolling: "no"
}}
});
}
$.extend(item, {
type: type,
src: url,
origSrc: item.src,
contentSource: provider,
contentType: type==="image" ? "image":provider=="gmap_place"||provider=="gmap_search" ? "map":"video"
});
}else if(url){
item.type=item.opts.defaultType;
}});
var VideoAPILoader={
youtube: {
src: "https://www.youtube.com/iframe_api",
class: "YT",
loading: false,
loaded: false
},
vimeo: {
src: "https://player.vimeo.com/api/player.js",
class: "Vimeo",
loading: false,
loaded: false
},
load: function (vendor){
var _this=this,
script;
if(this[vendor].loaded){
setTimeout(function (){
_this.done(vendor);
});
return;
}
if(this[vendor].loading){
return;
}
this[vendor].loading=true;
script=document.createElement("script");
script.type="text/javascript";
script.src=this[vendor].src;
if(vendor==="youtube"){
window.onYouTubeIframeAPIReady=function (){
_this[vendor].loaded=true;
_this.done(vendor);
};}else{
script.onload=function (){
_this[vendor].loaded=true;
_this.done(vendor);
};}
document.body.appendChild(script);
},
done: function (vendor){
var instance, $el, player;
if(vendor==="youtube"){
delete window.onYouTubeIframeAPIReady;
}
instance=$.modulaFancybox.getInstance();
if(instance){
$el=instance.current.$content.find("iframe");
if(vendor==="youtube"&&YT!==undefined&&YT){
player=new YT.Player($el.attr("id"), {
events: {
onStateChange: function (e){
if(e.data==0){
instance.next();
}}
}});
}else if(vendor==="vimeo"&&Vimeo!==undefined&&Vimeo){
player=new Vimeo.Player($el);
player.on("ended", function (){
instance.next();
});
}}
}};
$(document).on({
"afterShow.fb": function (e, instance, current){
if(instance.group.length > 1&&(current.contentSource==="youtube"||current.contentSource==="vimeo")){
VideoAPILoader.load(current.contentSource);
}}
});
})(jQuery);
(function (window, document, $){
"use strict";
var requestAFrame=(function (){
return (
window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
function (callback){
return window.setTimeout(callback, 1000 / 60);
}
);
})();
var cancelAFrame=(function (){
return (
window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame ||
window.oCancelAnimationFrame ||
function (id){
window.clearTimeout(id);
}
);
})();
var getPointerXY=function (e){
var result=[];
e=e.originalEvent||e || window.e;
e=e.touches&&e.touches.length ? e.touches:e.changedTouches&&e.changedTouches.length ? e.changedTouches:[e];
for (var key in e){
if(e[key].pageX){
result.push({
x: e[key].pageX,
y: e[key].pageY
});
}else if(e[key].clientX){
result.push({
x: e[key].clientX,
y: e[key].clientY
});
}}
return result;
};
var distance=function (point2, point1, what){
if(!point1||!point2){
return 0;
}
if(what==="x"){
return point2.x - point1.x;
}else if(what==="y"){
return point2.y - point1.y;
}
return Math.sqrt(Math.pow(point2.x - point1.x, 2) + Math.pow(point2.y - point1.y, 2));
};
var isClickable=function ($el){
if($el.is('a,area,button,[role="button"],input,label,select,summary,textarea,video,audio,iframe') ||
$.isFunction($el.get(0).onclick) ||
$el.data("selectable")
){
return true;
}
for (var i=0, atts=$el[0].attributes, n=atts.length; i < n; i++){
if(atts[i].nodeName.substr(0, 14)==="data-fancybox-"){
return true;
}}
return false;
};
var hasScrollbars=function (el){
var overflowY=window.getComputedStyle(el)["overflow-y"],
overflowX=window.getComputedStyle(el)["overflow-x"],
vertical=(overflowY==="scroll"||overflowY==="auto")&&el.scrollHeight > el.clientHeight,
horizontal=(overflowX==="scroll"||overflowX==="auto")&&el.scrollWidth > el.clientWidth;
return vertical||horizontal;
};
var isScrollable=function ($el){
var rez=false;
while (true){
rez=hasScrollbars($el.get(0));
if(rez){
break;
}
$el=$el.parent();
if(!$el.length||$el.hasClass("modula-fancybox-stage")||$el.is("body")){
break;
}}
return rez;
};
var Guestures=function (instance){
var self=this;
self.instance=instance;
self.$bg=instance.$refs.bg;
self.$stage=instance.$refs.stage;
self.$container=instance.$refs.container;
self.destroy();
self.$container.on("touchstart.fb.touch mousedown.fb.touch", $.proxy(self, "ontouchstart"));
};
Guestures.prototype.destroy=function (){
var self=this;
self.$container.off(".fb.touch");
$(document).off(".fb.touch");
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
if(self.tapped){
clearTimeout(self.tapped);
self.tapped=null;
}};
Guestures.prototype.ontouchstart=function (e){
var self=this,
$target=$(e.target),
instance=self.instance,
current=instance.current,
$slide=current.$slide,
$content=current.$content,
isTouchDevice=e.type=="touchstart";
if(isTouchDevice){
self.$container.off("mousedown.fb.touch");
}
if(e.originalEvent&&e.originalEvent.button==2){
return;
}
if(!$slide.length||!$target.length||isClickable($target)||isClickable($target.parent())){
return;
}
if(!$target.is("img")&&e.originalEvent.clientX > $target[0].clientWidth + $target.offset().left){
return;
}
if(!current||instance.isAnimating||current.$slide.hasClass("modula-fancybox-animated")){
e.stopPropagation();
e.preventDefault();
return;
}
self.realPoints=self.startPoints=getPointerXY(e);
if(!self.startPoints.length){
return;
}
if(current.touch){
e.stopPropagation();
}
self.startEvent=e;
self.canTap=true;
self.$target=$target;
self.$content=$content;
self.opts=current.opts.touch;
self.isPanning=false;
self.isSwiping=false;
self.isZooming=false;
self.isScrolling=false;
self.canPan=instance.canPan();
self.startTime=new Date().getTime();
self.distanceX=self.distanceY=self.distance=0;
self.canvasWidth=Math.round($slide[0].clientWidth);
self.canvasHeight=Math.round($slide[0].clientHeight);
self.contentLastPos=null;
self.contentStartPos=$.modulaFancybox.getTranslate(self.$content)||{
top: 0,
left: 0
};
self.sliderStartPos=$.modulaFancybox.getTranslate($slide);
self.stagePos=$.modulaFancybox.getTranslate(instance.$refs.stage);
self.sliderStartPos.top -=self.stagePos.top;
self.sliderStartPos.left -=self.stagePos.left;
self.contentStartPos.top -=self.stagePos.top;
self.contentStartPos.left -=self.stagePos.left;
$(document)
.off(".fb.touch")
.on(isTouchDevice ? "touchend.fb.touch touchcancel.fb.touch":"mouseup.fb.touch mouseleave.fb.touch", $.proxy(self, "ontouchend"))
.on(isTouchDevice ? "touchmove.fb.touch":"mousemove.fb.touch", $.proxy(self, "ontouchmove"));
if($.modulaFancybox.isMobile){
document.addEventListener("scroll", self.onscroll, true);
}
if(!(self.opts||self.canPan)||!($target.is(self.$stage)||self.$stage.find($target).length)){
if($target.is(".modula-fancybox-image")){
e.preventDefault();
}
if(!($.modulaFancybox.isMobile&&$target.parents(".modula-fancybox-caption").length)){
return;
}}
self.isScrollable=isScrollable($target)||isScrollable($target.parent());
if(!($.modulaFancybox.isMobile&&self.isScrollable)){
e.preventDefault();
}
if(self.startPoints.length===1||current.hasError){
if(self.canPan){
$.modulaFancybox.stop(self.$content);
self.isPanning=true;
}else{
self.isSwiping=true;
}
self.$container.addClass("modula-fancybox-is-grabbing");
}
if(self.startPoints.length===2&¤t.type==="image"&&(current.isLoaded||current.$ghost)){
self.canTap=false;
self.isSwiping=false;
self.isPanning=false;
self.isZooming=true;
$.modulaFancybox.stop(self.$content);
self.centerPointStartX=(self.startPoints[0].x + self.startPoints[1].x) * 0.5 - $(window).scrollLeft();
self.centerPointStartY=(self.startPoints[0].y + self.startPoints[1].y) * 0.5 - $(window).scrollTop();
self.percentageOfImageAtPinchPointX=(self.centerPointStartX - self.contentStartPos.left) / self.contentStartPos.width;
self.percentageOfImageAtPinchPointY=(self.centerPointStartY - self.contentStartPos.top) / self.contentStartPos.height;
self.startDistanceBetweenFingers=distance(self.startPoints[0], self.startPoints[1]);
}};
Guestures.prototype.onscroll=function (e){
var self=this;
self.isScrolling=true;
document.removeEventListener("scroll", self.onscroll, true);
};
Guestures.prototype.ontouchmove=function (e){
var self=this;
if(e.originalEvent.buttons!==undefined&&e.originalEvent.buttons===0){
self.ontouchend(e);
return;
}
if(self.isScrolling){
self.canTap=false;
return;
}
self.newPoints=getPointerXY(e);
if(!(self.opts||self.canPan)||!self.newPoints.length||!self.newPoints.length){
return;
}
if(!(self.isSwiping&&self.isSwiping===true)){
e.preventDefault();
}
self.distanceX=distance(self.newPoints[0], self.startPoints[0], "x");
self.distanceY=distance(self.newPoints[0], self.startPoints[0], "y");
self.distance=distance(self.newPoints[0], self.startPoints[0]);
if(self.distance > 0){
if(self.isSwiping){
self.onSwipe(e);
}else if(self.isPanning){
self.onPan();
}else if(self.isZooming){
self.onZoom();
}}
};
Guestures.prototype.onSwipe=function (e){
var self=this,
instance=self.instance,
swiping=self.isSwiping,
left=self.sliderStartPos.left||0,
angle;
if(swiping===true){
if(Math.abs(self.distance) > 10){
self.canTap=false;
if(instance.group.length < 2&&self.opts.vertical){
self.isSwiping="y";
}else if(instance.isDragging||self.opts.vertical===false||(self.opts.vertical==="auto"&&$(window).width() > 800)){
self.isSwiping="x";
}else{
angle=Math.abs((Math.atan2(self.distanceY, self.distanceX) * 180) / Math.PI);
self.isSwiping=angle > 45&&angle < 135 ? "y":"x";
}
if(self.isSwiping==="y"&&$.modulaFancybox.isMobile&&self.isScrollable){
self.isScrolling=true;
return;
}
instance.isDragging=self.isSwiping;
self.startPoints=self.newPoints;
$.each(instance.slides, function (index, slide){
var slidePos, stagePos;
$.modulaFancybox.stop(slide.$slide);
slidePos=$.modulaFancybox.getTranslate(slide.$slide);
stagePos=$.modulaFancybox.getTranslate(instance.$refs.stage);
slide.$slide
.css({
transform: "",
opacity: "",
"transition-duration": ""
})
.removeClass("modula-fancybox-animated")
.removeClass(function (index, className){
return (className.match(/(^|\s)fancybox-fx-\S+/g)||[]).join(" ");
});
if(slide.pos===instance.current.pos){
self.sliderStartPos.top=slidePos.top - stagePos.top;
self.sliderStartPos.left=slidePos.left - stagePos.left;
}
$.modulaFancybox.setTranslate(slide.$slide, {
top: slidePos.top - stagePos.top,
left: slidePos.left - stagePos.left
});
});
if(instance.SlideShow&&instance.SlideShow.isActive){
instance.SlideShow.stop();
}}
return;
}
if(swiping=="x"){
if(self.distanceX > 0 &&
(self.instance.group.length < 2||(self.instance.current.index===0&&!self.instance.current.opts.loop))
){
left=left + Math.pow(self.distanceX, 0.8);
}else if(self.distanceX < 0 &&
(self.instance.group.length < 2 ||
(self.instance.current.index===self.instance.group.length - 1&&!self.instance.current.opts.loop))
){
left=left - Math.pow(-self.distanceX, 0.8);
}else{
left=left + self.distanceX;
}}
self.sliderLastPos={
top: swiping=="x" ? 0:self.sliderStartPos.top + self.distanceY,
left: left
};
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.requestId=requestAFrame(function (){
if(self.sliderLastPos){
$.each(self.instance.slides, function (index, slide){
var pos=slide.pos - self.instance.currPos;
$.modulaFancybox.setTranslate(slide.$slide, {
top: self.sliderLastPos.top,
left: self.sliderLastPos.left + pos * self.canvasWidth + pos * slide.opts.gutter
});
});
self.$container.addClass("modula-fancybox-is-sliding");
}});
};
Guestures.prototype.onPan=function (){
var self=this;
if(distance(self.newPoints[0], self.realPoints[0]) < ($.modulaFancybox.isMobile ? 10:5)){
self.startPoints=self.newPoints;
return;
}
self.canTap=false;
self.contentLastPos=self.limitMovement();
if(self.requestId){
cancelAFrame(self.requestId);
}
self.requestId=requestAFrame(function (){
$.modulaFancybox.setTranslate(self.$content, self.contentLastPos);
});
};
Guestures.prototype.limitMovement=function (){
var self=this;
var canvasWidth=self.canvasWidth;
var canvasHeight=self.canvasHeight;
var distanceX=self.distanceX;
var distanceY=self.distanceY;
var contentStartPos=self.contentStartPos;
var currentOffsetX=contentStartPos.left;
var currentOffsetY=contentStartPos.top;
var currentWidth=contentStartPos.width;
var currentHeight=contentStartPos.height;
var minTranslateX, minTranslateY, maxTranslateX, maxTranslateY, newOffsetX, newOffsetY;
if(currentWidth > canvasWidth){
newOffsetX=currentOffsetX + distanceX;
}else{
newOffsetX=currentOffsetX;
}
newOffsetY=currentOffsetY + distanceY;
minTranslateX=Math.max(0, canvasWidth * 0.5 - currentWidth * 0.5);
minTranslateY=Math.max(0, canvasHeight * 0.5 - currentHeight * 0.5);
maxTranslateX=Math.min(canvasWidth - currentWidth, canvasWidth * 0.5 - currentWidth * 0.5);
maxTranslateY=Math.min(canvasHeight - currentHeight, canvasHeight * 0.5 - currentHeight * 0.5);
if(distanceX > 0&&newOffsetX > minTranslateX){
newOffsetX=minTranslateX - 1 + Math.pow(-minTranslateX + currentOffsetX + distanceX, 0.8)||0;
}
if(distanceX < 0&&newOffsetX < maxTranslateX){
newOffsetX=maxTranslateX + 1 - Math.pow(maxTranslateX - currentOffsetX - distanceX, 0.8)||0;
}
if(distanceY > 0&&newOffsetY > minTranslateY){
newOffsetY=minTranslateY - 1 + Math.pow(-minTranslateY + currentOffsetY + distanceY, 0.8)||0;
}
if(distanceY < 0&&newOffsetY < maxTranslateY){
newOffsetY=maxTranslateY + 1 - Math.pow(maxTranslateY - currentOffsetY - distanceY, 0.8)||0;
}
return {
top: newOffsetY,
left: newOffsetX
};};
Guestures.prototype.limitPosition=function (newOffsetX, newOffsetY, newWidth, newHeight){
var self=this;
var canvasWidth=self.canvasWidth;
var canvasHeight=self.canvasHeight;
if(newWidth > canvasWidth){
newOffsetX=newOffsetX > 0 ? 0:newOffsetX;
newOffsetX=newOffsetX < canvasWidth - newWidth ? canvasWidth - newWidth:newOffsetX;
}else{
newOffsetX=Math.max(0, canvasWidth / 2 - newWidth / 2);
}
if(newHeight > canvasHeight){
newOffsetY=newOffsetY > 0 ? 0:newOffsetY;
newOffsetY=newOffsetY < canvasHeight - newHeight ? canvasHeight - newHeight:newOffsetY;
}else{
newOffsetY=Math.max(0, canvasHeight / 2 - newHeight / 2);
}
return {
top: newOffsetY,
left: newOffsetX
};};
Guestures.prototype.onZoom=function (){
var self=this;
var contentStartPos=self.contentStartPos;
var currentWidth=contentStartPos.width;
var currentHeight=contentStartPos.height;
var currentOffsetX=contentStartPos.left;
var currentOffsetY=contentStartPos.top;
var endDistanceBetweenFingers=distance(self.newPoints[0], self.newPoints[1]);
var pinchRatio=endDistanceBetweenFingers / self.startDistanceBetweenFingers;
var newWidth=Math.floor(currentWidth * pinchRatio);
var newHeight=Math.floor(currentHeight * pinchRatio);
var translateFromZoomingX=(currentWidth - newWidth) * self.percentageOfImageAtPinchPointX;
var translateFromZoomingY=(currentHeight - newHeight) * self.percentageOfImageAtPinchPointY;
var centerPointEndX=(self.newPoints[0].x + self.newPoints[1].x) / 2 - $(window).scrollLeft();
var centerPointEndY=(self.newPoints[0].y + self.newPoints[1].y) / 2 - $(window).scrollTop();
var translateFromTranslatingX=centerPointEndX - self.centerPointStartX;
var translateFromTranslatingY=centerPointEndY - self.centerPointStartY;
var newOffsetX=currentOffsetX + (translateFromZoomingX + translateFromTranslatingX);
var newOffsetY=currentOffsetY + (translateFromZoomingY + translateFromTranslatingY);
var newPos={
top: newOffsetY,
left: newOffsetX,
scaleX: pinchRatio,
scaleY: pinchRatio
};
self.canTap=false;
self.newWidth=newWidth;
self.newHeight=newHeight;
self.contentLastPos=newPos;
if(self.requestId){
cancelAFrame(self.requestId);
}
self.requestId=requestAFrame(function (){
$.modulaFancybox.setTranslate(self.$content, self.contentLastPos);
});
};
Guestures.prototype.ontouchend=function (e){
var self=this;
var swiping=self.isSwiping;
var panning=self.isPanning;
var zooming=self.isZooming;
var scrolling=self.isScrolling;
self.endPoints=getPointerXY(e);
self.dMs=Math.max(new Date().getTime() - self.startTime, 1);
self.$container.removeClass("modula-fancybox-is-grabbing");
$(document).off(".fb.touch");
document.removeEventListener("scroll", self.onscroll, true);
if(self.requestId){
cancelAFrame(self.requestId);
self.requestId=null;
}
self.isSwiping=false;
self.isPanning=false;
self.isZooming=false;
self.isScrolling=false;
self.instance.isDragging=false;
if(self.canTap){
return self.onTap(e);
}
self.speed=100;
self.velocityX=(self.distanceX / self.dMs) * 0.5;
self.velocityY=(self.distanceY / self.dMs) * 0.5;
if(panning){
self.endPanning();
}else if(zooming){
self.endZooming();
}else{
self.endSwiping(swiping, scrolling);
}
return;
};
Guestures.prototype.endSwiping=function (swiping, scrolling){
var self=this,
ret=false,
len=self.instance.group.length,
distanceX=Math.abs(self.distanceX),
canAdvance=swiping=="x"&&len > 1&&((self.dMs > 130&&distanceX > 10)||distanceX > 50),
speedX=300;
self.sliderLastPos=null;
if(swiping=="y"&&!scrolling&&Math.abs(self.distanceY) > 50){
$.modulaFancybox.animate(self.instance.current.$slide, {
top: self.sliderStartPos.top + self.distanceY + self.velocityY * 150,
opacity: 0
},
200
);
ret=self.instance.close(true, 250);
}else if(canAdvance&&self.distanceX > 0){
ret=self.instance.previous(speedX);
}else if(canAdvance&&self.distanceX < 0){
ret=self.instance.next(speedX);
}
if(ret===false&&(swiping=="x"||swiping=="y")){
self.instance.centerSlide(200);
}
self.$container.removeClass("modula-fancybox-is-sliding");
};
Guestures.prototype.endPanning=function (){
var self=this,
newOffsetX,
newOffsetY,
newPos;
if(!self.contentLastPos){
return;
}
if(self.opts.momentum===false||self.dMs > 350){
newOffsetX=self.contentLastPos.left;
newOffsetY=self.contentLastPos.top;
}else{
newOffsetX=self.contentLastPos.left + self.velocityX * 500;
newOffsetY=self.contentLastPos.top + self.velocityY * 500;
}
newPos=self.limitPosition(newOffsetX, newOffsetY, self.contentStartPos.width, self.contentStartPos.height);
newPos.width=self.contentStartPos.width;
newPos.height=self.contentStartPos.height;
$.modulaFancybox.animate(self.$content, newPos, 366);
};
Guestures.prototype.endZooming=function (){
var self=this;
var current=self.instance.current;
var newOffsetX, newOffsetY, newPos, reset;
var newWidth=self.newWidth;
var newHeight=self.newHeight;
if(!self.contentLastPos){
return;
}
newOffsetX=self.contentLastPos.left;
newOffsetY=self.contentLastPos.top;
reset={
top: newOffsetY,
left: newOffsetX,
width: newWidth,
height: newHeight,
scaleX: 1,
scaleY: 1
};
$.modulaFancybox.setTranslate(self.$content, reset);
if(newWidth < self.canvasWidth&&newHeight < self.canvasHeight){
self.instance.scaleToFit(150);
}else if(newWidth > current.width||newHeight > current.height){
self.instance.scaleToActual(self.centerPointStartX, self.centerPointStartY, 150);
}else{
newPos=self.limitPosition(newOffsetX, newOffsetY, newWidth, newHeight);
$.modulaFancybox.animate(self.$content, newPos, 150);
}};
Guestures.prototype.onTap=function (e){
var self=this;
var $target=$(e.target);
var instance=self.instance;
var current=instance.current;
var endPoints=(e&&getPointerXY(e))||self.startPoints;
var tapX=endPoints[0] ? endPoints[0].x - $(window).scrollLeft() - self.stagePos.left:0;
var tapY=endPoints[0] ? endPoints[0].y - $(window).scrollTop() - self.stagePos.top:0;
var where;
var process=function (prefix){
var action=current.opts[prefix];
if($.isFunction(action)){
action=action.apply(instance, [current, e]);
}
if(!action){
return;
}
switch (action){
case "close":
instance.close(self.startEvent);
break;
case "toggleControls":
instance.toggleControls();
break;
case "next":
instance.next();
break;
case "nextOrClose":
if(instance.group.length > 1){
instance.next();
}else{
instance.close(self.startEvent);
}
break;
case "zoom":
if(current.type=="image"&&(current.isLoaded||current.$ghost)){
if(instance.canPan()){
instance.scaleToFit();
}else if(instance.isScaledDown()){
instance.scaleToActual(tapX, tapY);
}else if(instance.group.length < 2){
instance.close(self.startEvent);
}}
break;
}};
if(e.originalEvent&&e.originalEvent.button==2){
return;
}
if(!$target.is("img")&&tapX > $target[0].clientWidth + $target.offset().left){
return;
}
if($target.is(".modula-fancybox-bg,.modula-fancybox-inner,.modula-fancybox-outer,.modula-fancybox-container")){
where="Outside";
}else if($target.is(".modula-fancybox-slide")){
where="Slide";
}else if(instance.current.$content &&
instance.current.$content
.find($target)
.addBack()
.filter($target).length
){
where="Content";
}else{
return;
}
if(self.tapped){
clearTimeout(self.tapped);
self.tapped=null;
if(Math.abs(tapX - self.tapX) > 50||Math.abs(tapY - self.tapY) > 50){
return this;
}
process("dblclick" + where);
}else{
self.tapX=tapX;
self.tapY=tapY;
if(current.opts["dblclick" + where]&¤t.opts["dblclick" + where]!==current.opts["click" + where]){
self.tapped=setTimeout(function (){
self.tapped=null;
if(!instance.isAnimating){
process("click" + where);
}}, 500);
}else{
process("click" + where);
}}
return this;
};
$(document)
.on("onActivate.fb", function (e, instance){
if(instance&&!instance.Guestures){
instance.Guestures=new Guestures(instance);
}})
.on("beforeClose.fb", function (e, instance){
if(instance&&instance.Guestures){
instance.Guestures.destroy();
}});
})(window, document, jQuery);
(function (document, $){
"use strict";
$.extend(true, $.modulaFancybox.defaults, {
btnTpl: {
slideShow: '
"
},
slideShow: {
autoStart: false,
speed: 3000,
progress: true
}});
var SlideShow=function (instance){
this.instance=instance;
this.init();
};
$.extend(SlideShow.prototype, {
timer: null,
isActive: false,
$button: null,
init: function (){
var self=this,
instance=self.instance,
opts=instance.group[instance.currIndex].opts.slideShow;
self.$button=instance.$refs.toolbar.find("[data-fancybox-play]").on("click", function (){
self.toggle();
});
if(instance.group.length < 2||!opts){
self.$button.hide();
}else if(opts.progress){
self.$progress=$('
').appendTo(instance.$refs.inner);
}},
set: function (force){
var self=this,
instance=self.instance,
current=instance.current;
if(current&&(force===true||current.opts.loop||instance.currIndex < instance.group.length - 1)){
if(self.isActive&¤t.contentType!=="video"){
if(self.$progress){
$.modulaFancybox.animate(self.$progress.show(), {
scaleX: 1
}, current.opts.slideShow.speed);
}
self.timer=setTimeout(function (){
if(!instance.current.opts.loop&&instance.current.index==instance.group.length - 1){
instance.jumpTo(0);
}else{
instance.next();
}}, current.opts.slideShow.speed);
}}else{
self.stop();
instance.idleSecondsCounter=0;
instance.showControls();
}},
clear: function (){
var self=this;
clearTimeout(self.timer);
self.timer=null;
if(self.$progress){
self.$progress.removeAttr("style").hide();
}},
start: function (){
var self=this,
current=self.instance.current;
if(current){
self.$button
.attr("title", (current.opts.i18n[current.opts.lang]||current.opts.i18n.en).PLAY_STOP)
.removeClass("modula-fancybox-button--play")
.addClass("modula-fancybox-button--pause");
self.isActive=true;
if(current.isComplete){
self.set(true);
}
self.instance.trigger("onSlideShowChange", true);
}},
stop: function (){
var self=this,
current=self.instance.current;
self.clear();
self.$button
.attr("title", (current.opts.i18n[current.opts.lang]||current.opts.i18n.en).PLAY_START)
.removeClass("modula-fancybox-button--pause")
.addClass("modula-fancybox-button--play");
self.isActive=false;
self.instance.trigger("onSlideShowChange", false);
if(self.$progress){
self.$progress.removeAttr("style").hide();
}},
toggle: function (){
var self=this;
if(self.isActive){
self.stop();
}else{
self.start();
}}
});
$(document).on({
"onInit.fb": function (e, instance){
if(instance&&!instance.SlideShow){
instance.SlideShow=new SlideShow(instance);
}},
"beforeShow.fb": function (e, instance, current, firstRun){
var SlideShow=instance&&instance.SlideShow;
if(firstRun){
if(SlideShow&¤t.opts.slideShow.autoStart){
SlideShow.start();
}}else if(SlideShow&&SlideShow.isActive){
SlideShow.clear();
}},
"afterShow.fb": function (e, instance, current){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow&&SlideShow.isActive){
SlideShow.set();
}},
"afterKeydown.fb": function (e, instance, current, keypress, keycode){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow&¤t.opts.slideShow&&(keycode===80||keycode===32)&&!$(document.activeElement).is("button,a,input")){
keypress.preventDefault();
SlideShow.toggle();
}},
"beforeClose.fb onDeactivate.fb": function (e, instance){
var SlideShow=instance&&instance.SlideShow;
if(SlideShow){
SlideShow.stop();
}}
});
$(document).on("visibilitychange", function (){
var instance=$.modulaFancybox.getInstance(),
SlideShow=instance&&instance.SlideShow;
if(SlideShow&&SlideShow.isActive){
if(document.hidden){
SlideShow.clear();
}else{
SlideShow.set();
}}
});
})(document, jQuery);
(function (document, $){
"use strict";
var fn=(function (){
var fnMap=[
["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror"],
[
"webkitRequestFullscreen",
"webkitExitFullscreen",
"webkitFullscreenElement",
"webkitFullscreenEnabled",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
[
"webkitRequestFullScreen",
"webkitCancelFullScreen",
"webkitCurrentFullScreenElement",
"webkitCancelFullScreen",
"webkitfullscreenchange",
"webkitfullscreenerror"
],
[
"mozRequestFullScreen",
"mozCancelFullScreen",
"mozFullScreenElement",
"mozFullScreenEnabled",
"mozfullscreenchange",
"mozfullscreenerror"
],
["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError"]
];
var ret={};
for (var i=0; i < fnMap.length; i++){
var val=fnMap[i];
if(val&&val[1] in document){
for (var j=0; j < val.length; j++){
ret[fnMap[0][j]]=val[j];
}
return ret;
}}
return false;
})();
if(fn){
var FullScreen={
request: function (elem){
elem=elem||document.documentElement;
elem[fn.requestFullscreen](elem.ALLOW_KEYBOARD_INPUT);
},
exit: function (){
document[fn.exitFullscreen]();
},
toggle: function (elem){
elem=elem||document.documentElement;
if(this.isFullscreen()){
this.exit();
}else{
this.request(elem);
}},
isFullscreen: function (){
return Boolean(document[fn.fullscreenElement]);
},
enabled: function (){
return Boolean(document[fn.fullscreenEnabled]);
}};
$.extend(true, $.modulaFancybox.defaults, {
btnTpl: {
fullScreen: '
"
},
fullScreen: {
autoStart: false
}});
$(document).on(fn.fullscreenchange, function (){
var isFullscreen=FullScreen.isFullscreen(),
instance=$.modulaFancybox.getInstance();
if(instance){
if(instance.current&&instance.current.type==="image"&&instance.isAnimating){
instance.isAnimating=false;
instance.update(true, true, 0);
if(!instance.isComplete){
instance.complete();
}}
instance.trigger("onFullscreenChange", isFullscreen);
instance.$refs.container.toggleClass("modula-fancybox-is-fullscreen", isFullscreen);
instance.$refs.toolbar
.find("[data-fancybox-fullscreen]")
.toggleClass("modula-fancybox-button--fsenter", !isFullscreen)
.toggleClass("modula-fancybox-button--fsexit", isFullscreen);
}});
}
$(document).on({
"onInit.fb": function (e, instance){
var $container;
if(!fn){
instance.$refs.toolbar.find("[data-fancybox-fullscreen]").remove();
return;
}
if(instance&&instance.group[instance.currIndex].opts.fullScreen){
$container=instance.$refs.container;
$container.on("click.fb-fullscreen", "[data-fancybox-fullscreen]", function (e){
e.stopPropagation();
e.preventDefault();
FullScreen.toggle();
});
if(instance.opts.fullScreen&&instance.opts.fullScreen.autoStart===true){
FullScreen.request();
}
instance.FullScreen=FullScreen;
}else if(instance){
instance.$refs.toolbar.find("[data-fancybox-fullscreen]").hide();
}},
"afterKeydown.fb": function (e, instance, current, keypress, keycode){
if(instance&&instance.FullScreen&&keycode===70){
keypress.preventDefault();
instance.FullScreen.toggle();
}},
"beforeClose.fb": function (e, instance){
if(instance&&instance.FullScreen&&instance.$refs.container.hasClass("modula-fancybox-is-fullscreen")){
FullScreen.exit();
}}
});
})(document, jQuery);
(function (document, $){
"use strict";
var CLASS="modula-fancybox-thumbs",
CLASS_ACTIVE=CLASS + "-active";
$.modulaFancybox.defaults=$.extend(true, {
btnTpl: {
thumbs: '
"
},
thumbs: {
autoStart: false,
hideOnClose: true,
parentEl: ".modula-fancybox-container",
axis: "y"
}},
$.modulaFancybox.defaults
);
var modulaFancyThumbs=function (instance){
this.init(instance);
};
$.extend(modulaFancyThumbs.prototype, {
$button: null,
$grid: null,
$list: null,
isVisible: false,
isActive: false,
init: function (instance){
var self=this,
group=instance.group,
enabled=0;
self.instance=instance;
self.opts=group[instance.currIndex].opts.thumbs;
instance.Thumbs=self;
self.$button=instance.$refs.toolbar.find("[data-fancybox-thumbs]");
for (var i=0, len=group.length; i < len; i++){
if(group[i].thumb){
enabled++;
}
if(enabled > 1){
break;
}}
if(enabled > 1&&!!self.opts){
self.$button.removeAttr("style").on("click", function (){
self.toggle();
});
self.isActive=true;
}else{
self.$button.hide();
}},
create: function (){
var self=this,
instance=self.instance,
parentEl=self.opts.parentEl,
list=[],
src;
if(!self.$grid){
self.$grid=$('
').appendTo(instance.$refs.container
.find(parentEl)
.addBack()
.filter(parentEl)
);
self.$grid.on("click", "a", function (){
instance.jumpTo($(this).attr("data-index"));
});
}
if(!self.$list){
self.$list=$('
').appendTo(self.$grid);
}
$.each(instance.group, function (i, item){
src=item.thumb;
if(!src&&item.type==="image"){
src=item.src;
}
list.push('
"
);
});
self.$list[0].innerHTML=list.join("");
if(self.opts.axis==="x"){
self.$list.width(parseInt(self.$grid.css("padding-right"), 10) +
instance.group.length *
self.$list
.children()
.eq(0)
.outerWidth(true)
);
}},
focus: function (duration){
var self=this,
$list=self.$list,
$grid=self.$grid,
thumb,
thumbPos;
if(!self.instance.current){
return;
}
thumb=$list
.children()
.removeClass(CLASS_ACTIVE)
.filter('[data-index="' + self.instance.current.index + '"]')
.addClass(CLASS_ACTIVE);
thumbPos=thumb.position();
if(self.opts.axis==="y"&&(thumbPos.top < 0||thumbPos.top > $list.height() - thumb.outerHeight())){
$list.stop().animate({
scrollTop: $list.scrollTop() + thumbPos.top
},
duration
);
}else if(self.opts.axis==="x" &&
(thumbPos.left < $grid.scrollLeft()||thumbPos.left > $grid.scrollLeft() + ($grid.width() - thumb.outerWidth()))
){
$list
.parent()
.stop()
.animate({
scrollLeft: thumbPos.left
},
duration
);
}},
update: function (){
var that=this;
that.instance.$refs.container.toggleClass("modula-fancybox-show-thumbs", this.isVisible);
if(that.isVisible){
if(!that.$grid){
that.create();
}
that.instance.trigger("onThumbsShow");
that.focus(0);
}else if(that.$grid){
that.instance.trigger("onThumbsHide");
}
that.instance.update();
},
hide: function (){
this.isVisible=false;
this.update();
},
show: function (){
this.isVisible=true;
this.update();
},
toggle: function (){
this.isVisible = !this.isVisible;
this.update();
}});
$(document).on({
"onInit.fb": function (e, instance){
var Thumbs;
if(instance&&!instance.Thumbs){
Thumbs=new modulaFancyThumbs(instance);
if(Thumbs.isActive&&Thumbs.opts.autoStart===true){
Thumbs.show();
}}
},
"beforeShow.fb": function (e, instance, item, firstRun){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isVisible){
Thumbs.focus(firstRun ? 0:250);
}},
"afterKeydown.fb": function (e, instance, current, keypress, keycode){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isActive&&keycode===71){
keypress.preventDefault();
Thumbs.toggle();
}},
"beforeClose.fb": function (e, instance){
var Thumbs=instance&&instance.Thumbs;
if(Thumbs&&Thumbs.isVisible&&Thumbs.opts.hideOnClose!==false){
Thumbs.$grid.hide();
}}
});
})(document, jQuery);
(function (document, $){
"use strict";
$.extend(true, $.modulaFancybox.defaults, {
btnTpl: {
share: '
"
},
share: {
url: function (instance, item){
return (
(!instance.currentHash&&!(item.type==="inline"||item.type==="html") ? item.origSrc||item.src:false)||window.location
);
},
}});
function escapeHtml(string){
var entityMap={
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"/": "/",
"`": "`",
"=": "="
};
return String(string).replace(/[&<>"'`=\/]/g, function (s){
return entityMap[s];
});
}
$(document).on("click", "[data-fancybox-share]", function (){
var instance=$.modulaFancybox.getInstance(),
current=instance.current||null,
url,
tpl="
";
tpl=tpl.replace(/\{\{url_raw\}\}/g, escapeHtml(url));
/*
tpl=current.opts.share.tpl
.replace(/\{\{media\}\}/g, current.type==="image" ? encodeURIComponent(current.src):"")
.replace(/\{\{url\}\}/g, encodeURIComponent(url))
.replace(/\{\{url_raw\}\}/g, escapeHtml(url))
.replace(/\{\{descr\}\}/g, instance.$caption ? encodeURIComponent(instance.$caption.text()):"");*/
$.modulaFancybox.open({
src: instance.translate(instance, tpl),
type: "html",
opts: {
touch: false,
animationEffect: false,
afterLoad: function (shareInstance, shareCurrent){
instance.$refs.container.one("beforeClose.fb", function (){
shareInstance.close(null, 0);
});
shareCurrent.$content.find(".modula-fancybox-share__button").click(function (){
window.open(this.href, "Share", "width=550, height=450");
return false;
});
},
mobile: {
autoFocus: false
}}
});
});
})(document, jQuery);
(function (window, document, $){
"use strict";
if(!$.escapeSelector){
$.escapeSelector=function (sel){
var rcssescape=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
var fcssescape=function (ch, asCodePoint){
if(asCodePoint){
if(ch==="\0"){
return "\uFFFD";
}
return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
}
return "\\" + ch;
};
return (sel + "").replace(rcssescape, fcssescape);
};}
function parseUrl(){
var hash=window.location.hash.substr(1),
rez=hash.split("-"),
index=rez.length > 1&&/^\+?\d+$/.test(rez[rez.length - 1]) ? parseInt(rez.pop(-1), 10)||1:1,
gallery=rez.join("-");
return {
hash: hash,
index: index < 1 ? 1:index,
gallery: gallery
};}
function triggerFromUrl(url){
if(url.gallery!==""){
$("[data-fancybox='" + $.escapeSelector(url.gallery) + "']")
.eq(url.index - 1)
.focus()
.trigger("click.fb-start");
}}
function getGalleryID(instance){
var opts, ret;
if(!instance){
return false;
}
opts=instance.current ? instance.current.opts:instance.opts;
ret=opts.hash||(opts.$orig ? opts.$orig.data("fancybox")||opts.$orig.data("fancybox-trigger"):"");
return ret==="" ? false:ret;
}
$(function (){
if($.modulaFancybox.defaults.hash===false){
return;
}
$(document).on({
"onInit.fb": function (e, instance){
var url, gallery;
if(instance.group[instance.currIndex].opts.hash===false){
return;
}
url=parseUrl();
gallery=getGalleryID(instance);
if(gallery&&url.gallery&&gallery==url.gallery){
instance.currIndex=url.index - 1;
}},
"beforeShow.fb": function (e, instance, current, firstRun){
var gallery;
if(!current||current.opts.hash===false){
return;
}
gallery=getGalleryID(instance);
if(!gallery){
return;
}
instance.currentHash=gallery + (instance.group.length > 1 ? "-" + (current.index + 1):"");
if(window.location.hash==="#" + instance.currentHash){
return;
}
if(firstRun&&!instance.origHash){
instance.origHash=window.location.hash;
}
if(instance.hashTimer){
clearTimeout(instance.hashTimer);
}
instance.hashTimer=setTimeout(function (){
if("replaceState" in window.history){
window.history[firstRun ? "pushState":"replaceState"]({},
document.title,
window.location.pathname + window.location.search + "#" + instance.currentHash
);
if(firstRun){
instance.hasCreatedHistory=true;
}}else{
window.location.hash=instance.currentHash;
}
instance.hashTimer=null;
}, 300);
},
"beforeClose.fb": function (e, instance, current){
if(!current||current.opts.hash===false){
return;
}
clearTimeout(instance.hashTimer);
if(instance.currentHash&&instance.hasCreatedHistory){
window.history.back();
}else if(instance.currentHash){
if("replaceState" in window.history){
window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (instance.origHash||""));
}else{
window.location.hash=instance.origHash;
}}
instance.currentHash=null;
}});
$(window).on("hashchange.fb", function (){
var url=parseUrl(),
fb=null;
$.each($(".modula-fancybox-container")
.get()
.reverse(),
function (index, value){
var tmp=$(value).data("modulaFancyBox");
if(tmp&&tmp.currentHash){
fb=tmp;
return false;
}}
);
if(fb){
if(fb.currentHash!==url.gallery + "-" + url.index&&!(url.index===1&&fb.currentHash==url.gallery)){
fb.currentHash=null;
fb.close();
}}else if(url.gallery!==""){
triggerFromUrl(url);
}});
setTimeout(function (){
if(!$.modulaFancybox.getInstance()){
triggerFromUrl(parseUrl());
}}, 50);
});
})(window, document, jQuery);
(function (document, $){
"use strict";
var prevTime=new Date().getTime();
$(document).on({
"onInit.fb": function (e, instance, current){
instance.$refs.stage.on("mousewheel DOMMouseScroll wheel MozMousePixelScroll", function (e){
var current=instance.current,
currTime=new Date().getTime();
if(instance.group.length < 2||current.opts.wheel===false||(current.opts.wheel==="auto"&¤t.type!=="image")){
return;
}
e.preventDefault();
e.stopPropagation();
if(current.$slide.hasClass("modula-fancybox-animated")){
return;
}
e=e.originalEvent||e;
if(currTime - prevTime < 250){
return;
}
prevTime=currTime;
instance[(-e.deltaY||-e.deltaX||e.wheelDelta||-e.detail) < 0 ? "next":"previous"]();
});
}});
})(document, jQuery);
!function(e,i){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(t){return i(e,t)}):"object"==typeof module&&module.exports?module.exports=i(e,require("jquery")):e.jQueryBridget=i(e,e.jQuery)}(window,function(t,e){"use strict";var i=Array.prototype.slice,o=t.console,d=void 0===o?function(){}:function(t){o.error(t)};function n(h,n,l){(l=l||e||t.jQuery)&&(n.prototype.option||(n.prototype.option=function(t){l.isPlainObject(t)&&(this.options=l.extend(!0,this.options,t))}),l.fn[h]=function(t){return"string"==typeof t?function(t,s,r){var a,u="$()."+h+'("'+s+'")';return t.each(function(t,e){var i=l.data(e,h);if(i){var o=i[s];if(o&&"_"!=s.charAt(0)){var n=o.apply(i,r);a=void 0===a?n:a}else d(u+" is not a valid method")}else d(h+" not initialized. Cannot call methods, i.e. "+u)}),void 0!==a?a:t}(this,t,i.call(arguments,1)):(function(t,o){t.each(function(t,e){var i=l.data(e,h);i?(i.option(o),i._init()):(i=new n(e,o),l.data(e,h,i))})}(this,t),this)},s(l))}function s(t){!t||t&&t.bridget||(t.bridget=n)}return s(e||t.jQuery),n}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},o=i[t]=i[t]||[];return-1==o.indexOf(e)&&o.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var o=i.indexOf(e);return-1!=o&&i.splice(o,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var o=this._onceEvents&&this._onceEvents[t],n=0;n
this.cols?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},i._manageStamp=function(t){var e=h(t),i=this._getElementOffset(t),o=this._getOption("originLeft")?i.left:i.right,n=o+e.outerWidth,s=Math.floor(o/this.columnWidth);s=Math.max(0,s);var r=Math.floor(n/this.columnWidth);r-=n%this.columnWidth?0:1,r=Math.min(this.cols-1,r);for(var a=(this._getOption("originTop")?i.top:i.bottom)+e.outerHeight,u=s;u<=r;u++)this.colYs[u]=Math.max(a,this.colYs[u])},i._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},i._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},i.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/masonry",["../layout-mode","masonry-layout/masonry"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode"),require("masonry-layout")):e(t.ModulaIsotope.LayoutMode,t.Masonry)}(window,function(t,e){"use strict";var i=t.create("masonry"),o=i.prototype,n={_getElementOffset:!0,layout:!0,_getMeasurement:!0};for(var s in e.prototype)n[s]||(o[s]=e.prototype[s]);var r=o.measureColumns;o.measureColumns=function(){this.items=this.isotope.filteredItems,r.call(this)};var a=o._getOption;return o._getOption=function(t){return"fitWidth"==t?void 0!==this.options.isFitWidth?this.options.isFitWidth:this.options.fitWidth:a.apply(this.isotope,arguments)},i}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/fit-rows",["../layout-mode"],e):"object"==typeof exports?module.exports=e(require("../layout-mode")):e(t.ModulaIsotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("fitRows"),i=e.prototype;return i._resetLayout=function(){this.x=0,this.y=0,this.maxY=0,this._getMeasurement("gutter","outerWidth")},i._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth+this.gutter,i=this.isotope.size.innerWidth+this.gutter;0!==this.x&&e+this.x>i&&(this.x=0,this.y=this.maxY);var o={x:this.x,y:this.y};return this.maxY=Math.max(this.maxY,this.y+t.size.outerHeight),this.x+=e,o},i._getContainerSize=function(){return{height:this.maxY}},e}),function(t,e){"function"==typeof define&&define.amd?define("isotope-layout/js/layout-modes/vertical",["../layout-mode"],e):"object"==typeof module&&module.exports?module.exports=e(require("../layout-mode")):e(t.ModulaIsotope.LayoutMode)}(window,function(t){"use strict";var e=t.create("vertical",{horizontalAlignment:0}),i=e.prototype;return i._resetLayout=function(){this.y=0},i._getItemLayoutPosition=function(t){t.getSize();var e=(this.isotope.size.innerWidth-t.size.outerWidth)*this.options.horizontalAlignment,i=this.y;return this.y+=t.size.outerHeight,{x:e,y:i}},i._getContainerSize=function(){return{height:this.y}},e}),function(r,a){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","desandro-matches-selector/matches-selector","fizzy-ui-utils/utils","isotope-layout/js/item","isotope-layout/js/layout-mode","isotope-layout/js/layout-modes/masonry","isotope-layout/js/layout-modes/fit-rows","isotope-layout/js/layout-modes/vertical"],function(t,e,i,o,n,s){return a(r,t,e,i,o,n,s)}):"object"==typeof module&&module.exports?module.exports=a(r,require("outlayer"),require("get-size"),require("desandro-matches-selector"),require("fizzy-ui-utils"),require("isotope-layout/js/item"),require("isotope-layout/js/layout-mode"),require("isotope-layout/js/layout-modes/masonry"),require("isotope-layout/js/layout-modes/fit-rows"),require("isotope-layout/js/layout-modes/vertical")):r.ModulaIsotope=a(r,r.Outlayer,r.getSize,r.matchesSelector,r.fizzyUIUtils,r.ModulaIsotope.Item,r.ModulaIsotope.LayoutMode)}(window,function(t,i,e,o,s,n,r){var a=t.jQuery,u=String.prototype.trim?function(t){return t.trim()}:function(t){return t.replace(/^\s+|\s+$/g,"")},h=i.create("modulaisotope",{layoutMode:"masonry",isJQueryFiltering:!0,sortAscending:!0});h.Item=n,h.LayoutMode=r;var l=h.prototype;l._create=function(){for(var t in this.itemGUID=0,this._sorters={},this._getSorters(),i.prototype._create.call(this),this.modes={},this.filteredItems=this.items,this.sortHistory=["original-order"],r.modes)this._initLayoutMode(t)},l.reloadItems=function(){this.itemGUID=0,i.prototype.reloadItems.call(this)},l._itemize=function(){for(var t=i.prototype._itemize.apply(this,arguments),e=0;e=t.x+e&&this.y+this.height>=t.y+i},t.overlaps=function(t){var e=this.x+this.width,i=this.y+this.height,s=t.x+t.width,r=t.y+t.height;return this.xt.x&&this.yt.y},t.getMaximalFreeRects=function(t){if(!this.overlaps(t))return!1;var e,i=[],s=this.x+this.width,r=this.y+this.height,h=t.x+t.width,n=t.y+t.height;return this.y=t.width&&this.height>=t.height},o}),function(t,e){if("function"==typeof define&&define.amd)define("packery/js/packer",["./rect"],e);else if("object"==typeof module&&module.exports)module.exports=e(require("./rect"));else{var i=t.Packery=t.Packery||{};i.Packer=e(i.Rect)}}(window,function(e){function t(t,e,i){this.width=t||0,this.height=e||0,this.sortDirection=i||"downwardLeftToRight",this.reset()}var i=t.prototype;i.reset=function(){this.spaces=[];var t=new e({x:0,y:0,width:this.width,height:this.height});this.spaces.push(t),this.sorter=s[this.sortDirection]||s.downwardLeftToRight},i.pack=function(t){for(var e=0;e=t.x+t.width&&i.height>=t.height-.01){t.y=i.y,this.placed(t);break}}},i.rowPack=function(t){for(var e=0;e=t.y+t.height&&i.width>=t.width-.01){t.x=i.x,this.placed(t);break}}},i.placeInSpace=function(t,e){t.x=e.x,t.y=e.y,this.placed(t)},i.placed=function(t){for(var e=[],i=0;i=t.width-1&&this.height>=t.height-1};var s=t.create("packery");s.Item=i;var r=s.prototype;function h(t,e){return t.position.y-e.position.y||t.position.x-e.position.x}function n(t,e){return t.position.x-e.position.x||t.position.y-e.position.y}r._create=function(){t.prototype._create.call(this),this.packer=new e,this.shiftPacker=new e,this.isEnabled=!0,this.dragItemCount=0;var i=this;this.handleDraggabilly={dragStart:function(){i.itemDragStart(this.element)},dragMove:function(){i.itemDragMove(this.element,this.position.x,this.position.y)},dragEnd:function(){i.itemDragEnd(this.element)}},this.handleUIDraggable={start:function(t,e){e&&i.itemDragStart(t.currentTarget)},drag:function(t,e){e&&i.itemDragMove(t.currentTarget,e.position.left,e.position.top)},stop:function(t,e){e&&i.itemDragEnd(t.currentTarget)}}},r._resetLayout=function(){var t,e,i;this.getSize(),this._getMeasurements(),i=this._getOption("horizontal")?(t=1/0,e=this.size.innerHeight+this.gutter,"rightwardTopToBottom"):(t=this.size.innerWidth+this.gutter,e=1/0,"downwardLeftToRight"),this.packer.width=this.shiftPacker.width=t,this.packer.height=this.shiftPacker.height=e,this.packer.sortDirection=this.shiftPacker.sortDirection=i,this.packer.reset(),this.maxY=0,this.maxX=0},r._getMeasurements=function(){this._getMeasurement("columnWidth","width"),this._getMeasurement("rowHeight","height"),this._getMeasurement("gutter","width")},r._getItemLayoutPosition=function(t){if(this._setRectSize(t.element,t.rect),this.isShifting||049?function(){d(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:Y(function(){$(t)},true);return function(e){var t;if(e=e===true){n=33}if(i){return}i=true;t=r-(o.now()-a);if(t<0){t=0}if(e||t<9){s()}else{$(s,t)}}},ee=function(e){var t,i;var a=99;var r=function(){t=null;e()};var n=function(){var e=o.now()-i;if(e0;if(r&&V(a,"overflow")!="visible"){i=a.getBoundingClientRect();r=C>i.left&&pi.top-1&&g500&&O.clientWidth>500?500:370:H.expand;D._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w2&&z>2&&!k.hidden){w=f;N=0}else if(z>1&&N>1&&M<6){w=u}else{w=_}for(;t=s&&(g=i.top)<=y&&(C=i.right)>=s*c&&(p=i.left)<=h&&(b||C||p||g)&&(H.loadHidden||W(d[t]))&&(m&&M<3&&!l&&(z<3||N<4)||T(d[t],n))){R(d[t]);r=true;if(M>9){break}}else if(!r&&m&&!a&&M<4&&N<4&&z>2&&(v[0]||H.preloadAfterLoad)&&(v[0]||!l&&(b||C||p||g||d[t][P](H.sizesAttr)!="auto"))){a=v[0]||d[t]}}if(a&&!r){R(a)}}};var i=Z(e);var B=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}x(e);G(t,H.loadedClass);J(t,H.loadingClass);K(t,F);Q(t,"lazyloaded")};var a=Y(B);var F=function(e){a({target:e.target})};var S=function(t,i){try{t.contentWindow.location.replace(i)}catch(e){t.src=i}};var L=function(e){var t;var i=e[P](H.srcsetAttr);if(t=H.customMedia[e[P]("data-media")||e[P]("media")]){e.setAttribute("media",t)}if(i){e.setAttribute("srcset",i)}};var s=Y(function(e,t,i,a,r){var n,s,l,o,u,f;if(!(u=Q(e,"lazybeforeunveil",t)).defaultPrevented){if(a){if(i){G(e,H.autosizesClass)}else{e.setAttribute("sizes",a)}}s=e[P](H.srcsetAttr);n=e[P](H.srcAttr);if(r){l=e.parentNode;o=l&&I.test(l.nodeName||"")}f=t.firesLoad||"src"in e&&(s||n||o);u={target:e};G(e,H.loadingClass);if(f){clearTimeout(c);c=$(x,2500);K(e,F,true)}if(o){q.call(l.getElementsByTagName("source"),L)}if(s){e.setAttribute("srcset",s)}else if(n&&!o){if(d.test(e.nodeName)){S(e,n)}else{e.src=n}}if(r&&(s||o)){U(e,{src:n})}}if(e._lazyRace){delete e._lazyRace}J(e,H.lazyClass);X(function(){if(!f||e.complete&&e.naturalWidth>1){B(u);e._lazyCache=true;$(function(){if("_lazyCache"in e){delete e._lazyCache}},9)}},true)});var R=function(e){var t;var i=n.test(e.nodeName);var a=i&&(e[P](H.sizesAttr)||e[P]("sizes"));var r=a=="auto";if((r||!m)&&i&&(e[P]("src")||e.srcset)&&!e.complete&&!j(e,H.errorClass)&&j(e,H.lazyClass)){return}t=Q(e,"lazyunveilread").detail;if(r){te.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;M++;s(e,t,r,a,i)};var r=function(){if(m){return}if(o.now()-t<999){$(r,999);return}var e=ee(function(){H.loadMode=3;i()});m=true;H.loadMode=3;i();f("scroll",function(){if(H.loadMode==3){H.loadMode=2}e()},true)};return{_:function(){t=o.now();D.elements=k.getElementsByClassName(H.lazyClass);v=k.getElementsByClassName(H.lazyClass+" "+H.preloadClass);f("scroll",i,true);f("resize",i,true);if(l.MutationObserver){new MutationObserver(i).observe(O,{childList:true,subtree:true,attributes:true})}else{O[u]("DOMNodeInserted",i,true);O[u]("DOMAttrModified",i,true);setInterval(i,999)}f("hashchange",i,true);["focus","mouseover","click","load","transitionend","animationend","webkitAnimationEnd"].forEach(function(e){k[u](e,i,true)});if(/d$|^c/.test(k.readyState)){r()}else{f("load",r);k[u]("DOMContentLoaded",i);$(r,2e4)}if(D.elements.length){e();X._lsFlush()}else{i()}},checkElems:i,unveil:R}}(),te=function(){var i;var n=Y(function(e,t,i,a){var r,n,s;e._lazysizesWidth=a;a+="px";e.setAttribute("sizes",a);if(I.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;na.height?"tile-h":"tile-v").data("position"),c(i).css(c(i).data("size")),c(i).find(".figc").css({width:c(i).data("size").width,height:c(i).data("size").height}),r.loadImage(t)});var e={itemSelector:".modula-item",layoutMode:"packery",packery:{gutter:parseInt(d.options.gutter)}};this.$itemsCnt.modulaisotope(e),this.isIsotope=!0},h.prototype.createGrid=function(){var o=this;this.$itemsCnt.data("area",this.$itemsCnt.width()*this.options.height),this.lastWidth=this.$itemsCnt.width();for(var t=0;te.height?"tile-h":"tile-v").data("position"),c(i).css({width:e.width,height:e.height}),c(i).find(".figc").css({width:e.width,height:e.height}),o.loadImage(t)}),!this.isIsotope){var i={resizesContainer:!1,itemSelector:".modula-item",layoutMode:"packery",packery:{gutter:parseInt(o.options.gutter)}};this.$itemsCnt.modulaisotope(i),this.isIsotope=!0}},h.prototype.createAutoGrid=function(){this.$itemsCnt.justifiedGallery({rowHeight:this.options.rowHeight,margins:this.options.gutter,lastRow:this.options.lastRow,captions:!1,border:0,imgSelector:".pic",cssAnimation:!0,imagesAnimationDuration:700})},h.prototype.createColumnsGrid=function(){var e=this;this.$itemsCnt.modulaisotope({itemSelector:".modula-item",layoutMode:"packery",packery:{gutter:parseInt(this.options.gutter)}}),this.$items.each(function(t,i){e.loadImage(t)}),this.isIsotope=!0},h.prototype.getSlot=function(){if(0==this.tiles.length)return e={top:0,left:0,width:this.$itemsCnt.width(),height:this.options.height,area:this.$itemsCnt.width()*this.options.height,position:0};for(var t=0,i=0;ithis.tiles[t].area&&(t=i)}var e={},o=this.tiles[t];if(o.width>o.height){var n=o.width/2*this.options.randomFactor;o.prevWidth=o.width,o.width=Math.floor(o.width/2+n*(Math.random()-.5)),e={top:o.top,left:o.left+o.width+this.options.gutter,width:o.prevWidth-o.width-this.options.gutter,height:o.height}}else{n=o.height/2*this.options.randomFactor;o.prevHeight=o.height,o.height=Math.floor(o.height/2+n*(Math.random()-.5)),e={left:o.left,top:o.top+o.height+this.options.gutter,width:o.width,height:o.prevHeight-o.height-this.options.gutter}}return e.area=e.width*e.height,e.position=1e3*e.top+e.left,o.position=1e3*o.top+o.left,this.tiles[t]=o,this.tiles[t].area=o.width*o.height,e},h.prototype.reset=function(){this.tiles=[],"custom-grid"===this.options.type?this.createCustomGallery():"creative-gallery"==this.options.type?this.createGrid():"grid"==this.options.type&&("automatic"==this.options.grid_type?this.createAutoGrid():this.createColumnsGrid()),this.lastWidth=this.$itemsCnt.width(),c(a).trigger("modula_api_reset",[this])},h.prototype.onResize=function(i){i.lastWidth!=i.$itemsCnt.width()&&(clearTimeout(i.resizeTO),i.resizeTO=setTimeout(function(){if(i.options.keepArea){var t=i.$itemsCnt.data("area");i.$itemsCnt.height(t/i.$itemsCnt.width())}i.reset(),i.isIsotope&&i.$itemsCnt.modulaisotope("layout")},100))},h.prototype.loadImage=function(t){var i=this,e=i.$items.not(".jtg-hidden").eq(t).find(".pic"),o={};if("undefined"!=e.attr("width")&&"undefined"!=e.attr("height")){var n=new Image;n.onload=function(){o={width:this.width,height:this.height},e.data("size",o),i.placeImage(t)},"undefined"!=e.attr("src")?n.src=e.attr("src"):n.src=e.data("src")}else o={width:e.width(),height:e.height()},e.data("size",o),i.placeImage(t)},h.prototype.placeImage=function(t){if("grid"!=this.options.type){var i=this.$items.not(".jtg-hidden").eq(t),e=i.find(".pic"),o=i.data("size"),n=e.data("size");if(void 0!==o&&void 0!==n){o.width,o.height;var s=n.width/n.height,a=e.data("valign")?e.data("valign"):"middle",h=e.data("halign")?e.data("halign"):"center",r={top:"auto",bottom:"auto",left:"auto",right:"auto",width:"auto",height:"auto",margin:"0",maxWidth:"999em"};if(o.width*n.height/n.width>o.height)switch(r.width=o.width,r.left=0,a){case"top":r.top=0;break;case"middle":r.top=0-(o.width*(1/s)-o.height)/2;break;case"bottom":r.bottom=0}else switch(r.height=o.height,r.top=0,h){case"left":r.left=0;break;case"center":r.left=0-(o.height*s-o.width)/2;break;case"right":r.right=0}e.css(r),this.$items.not(".jtg-hidden").eq(t).addClass("tg-loaded")}}},h.prototype.setupSocial=function(){this.options.enableTwitter&&i(this.$items,this),this.options.enableFacebook&&o(this.$items,this),this.options.enablePinterest&&d(this.$items,this),this.options.enableLinkedin&&l(this.$items,this),this.options.enableWhatsapp&&r(this.$items,this)},h.prototype.destroy=function(){this.isPackeryActive&&(this.$itemsCnt.packery("destroy"),this.isPackeryActive=!1)};var i=function(t,e){t.find(".modula-icon-twitter").click(function(t){t.preventDefault();var i=e.options.twitterText||a.title;return!e.options.twitterText&&1=="".length&&0<"".text().length&&(i=c.trim("".text())),s.open("https://twitter.com/intent/tweet?url="+encodeURI(location.href.split("#")[0])+"&text="+encodeURI(i),"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},o=function(t,o){t.find(".modula-icon-facebook").click(function(t){t.preventDefault();var i=c(this).parents(".tile:first").find(".pic");o.options.facebookText||a.title;!o.options.facebookText&&1=="".length&&0<"".text().length&&c.trim("".text());i.attr("src");var e="//www.facebook.com/sharer.php?u="+location.href;return s.open(e,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},r=function(t,i){t.find(".modula-icon-whatsapp").click(function(t){t.preventDefault();i.options.whatsappText||a.title;return!i.options.whatsappText&&1=="".length&&0<"".text().length&&c.trim("".text()),s.open("https://api.whatsapp.com/send?text="+encodeURI(s.location.href.split("#")[0])+"&preview_url=true","ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},d=function(t,n){t.find(".modula-icon-pinterest").click(function(t){t.preventDefault();var i=c(this).parents(".modula-item").find(".pic"),e=n.options.pinterestText||a.title;!n.options.pinterestText&&1=="".length&&0<"".text().length&&(e=c.trim("".text()));var o="http://pinterest.com/pin/create/button/?url="+encodeURI(location.href)+"&description="+encodeURI(e);1==i.length&&(o+="&media="+function(t){var i=a.createElement("img");return i.src=t,t=i.src,i.src=null,t}(i.attr("src")));return s.open(o,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})},l=function(t,i){t.find(".modula-icon-linkedin").click(function(t){t.preventDefault();var i="//linkedin.com/shareArticle?mini=true&url="+ +encodeURI(location.href);return s.open(i,"ftgw","location=1,status=1,scrollbars=1,width=600,height=400").moveTo(screen.width/2-300,screen.height/2-200),!1})};c.fn[n]=function(i){var e,o=arguments;return i===t||"object"==typeof i?this.each(function(){c.data(this,"plugin_"+n)||c.data(this,"plugin_"+n,new h(this,i))}):"string"==typeof i&&"_"!==i[0]&&"init"!==i?(this.each(function(){var t=c.data(this,"plugin_"+n);t instanceof h&&"function"==typeof t[i]&&(e=t[i].apply(t,Array.prototype.slice.call(o,1))),"destroy"===i&&c.data(this,"plugin_"+n,null)}),e!==t?e:this):void 0}}(jQuery,window,document),jQuery(document).ready(function(){var t=jQuery(".modula.modula-gallery");jQuery.each(t,function(){var t=jQuery(this).attr("id"),i=jQuery(this).data("config");jQuery("#"+t).modulaGallery(i)})});